import { GBox } from "../../../../../com/mui/containers/GBox";
import { GBoxDirection } from "../../../../../com/mui/containers/globalVariable/GBoxDirection";
import { ObjectPool } from "../../../../../com/gengine/utils/pools/ObjectPool";
import { QuestionItem } from "./QuestionItem";
type int = number;
//class QuestionList
    
    export  class QuestionList /* flash.display.Sprite */
    {
        constructor()
        {
            
            mouseEnabled = false;
            this._bodySprite = new GBox();
            this._bodySprite.direction = GBoxDirection.VERTICAL;
            addChild(this._bodySprite);
            return;
        }

        public updateData(arg1: Array<any>): void
        {
            var loc3=null;
            var loc4=null;
            this.dispose();
            var loc1=0;
            var loc2=arg1.length;
            while (loc1 < loc2) 
            {
                loc3 = arg1[loc1];
                (loc4 = ObjectPool.getObject(QuestionItem)).updateData(loc3);
                this._bodySprite.addChild(loc4);
                this._height = this._height + loc4.height;
                ++loc1;
            }
            this._bodySprite.invalidate();
            return;
        }

        public dispose(): void
        {
            var loc1=null;
            this._height = 0;
            while (this._bodySprite.numChildren > 0) 
            {
                loc1 = this._bodySprite.removeChildAt(0) as QuestionItem;
                loc1.dispose();
                ObjectPool.disposeObject(loc1, QuestionItem);
            }
            return;
        }

        public /* override */ get height(): number
        {
            if (this._height > 0) 
            {
                return this._height + 10;
            }
            return this._height;
        }

        /* internal */ /* var */_bodySprite: GBox;

        /* internal */ /* var */_height: int;
    }
